﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml;
using System.IO;
using System.Xml.Serialization;

namespace YhmOA.PrintDoc.Bank
{
    public partial class TerritoryPayment : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                this.rvShow.Reset();
                this.rvShow.LocalReport.LoadReportDefinition(CreateRdlc());
                this.rvShow.LocalReport.DisplayName = "境内汇款申请书";
                this.rvShow.LocalReport.DataSources.Clear();
                this.rvShow.LocalReport.Refresh();
            }
        }

        private MemoryStream CreateRdlc()
        {
            XmlDocument sourceDoc = new XmlDocument();
            string docPath = AppDomain.CurrentDomain.BaseDirectory + "PrintDoc\\Bank\\TerritoryPayment.rdlc";
            sourceDoc.Load(docPath);


            MemoryStream ms = new MemoryStream();
            XmlSerializer serializer = new XmlSerializer(typeof(XmlDocument));
            serializer.Serialize(ms, sourceDoc);
            ms.Position = 0;
            return ms;
        }
    }
}